
var this_id = '';
var this_pid= '';
var this_max= '';


var PAGES = {
	
	
	//  实例化表格
	init_table:function(t_w){
		layui.use(function(){
		  var table = layui.table;
		  
		  // 已知数据渲染
		  var inst = table.render({
			width:t_w,  
			even: true,
			page: {theme:'#C10D26'}, 
			limits: false,
			limit: 13, // 每页默认显示的数量
		    elem: '#ID-table-demo-data',
		    cols: [[ //标题栏
		      {field: 'id', title: '序号', width: 40,type:'numbers',fixed:"left",align:"center" },
		      {field: 'a1', title: '品牌logo', minWidth: 100,fixed:"left",align:"center",templet: '#TPL-logo'},
		      {field: 'a2', title: '编码', minWidth: 100},
		      {field: 'a3', title: '名称-英文', minWidth: 90},
		      {field: 'a4', title: '名称-中文', minWidth: 90},
		      {field: 'a5', title: '成立时间', minWidth: 80, },
		      {field: 'a6', title: 'PLC开始时间', minWidth: 90, },
		      {field: 'a7', title: '所属国家', minWidth: 80, },
		      {field: 'a8', title: '品牌Slogan', minWidth: 120, },
		      {field: 'a9', title: '在中国公司实体名称', minWidth: 140, },
		      {field: 'a10', title: '中国地区地址', minWidth: 100, },
		      {field: 'a11', title: '网站', minWidth: 140, },
		      {field: 'a12', title: '是否能做代工', minWidth: 100, },
		      {field: 'a13', title: '股票代码', minWidth: 100, },
		      {field: 'a14', title: '评分', minWidth: 80, },
		      {field: 'a15', title: '粉丝数', minWidth: 80, },
		      {field: 'a16', title: '接收邮箱地址', minWidth: 130, },
		      {field: 'a17', title: '品牌介绍', minWidth: 140, },
		    ]],
			
		    data: [
				{"id": "1","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "2","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "3","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "4","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
				{"id": "5","a1": "张三1","a2": "Siemens-PLC-0001","a3": "Siemens","a4": "西门子","a5":"1847年","a6":"1960","a7":"德国","a8":"西门子,不仅是一个产品的名称,更是一种文化。","a9":"西门子（中国）有限公司","a10":"北京","a11":"https://www.siemens.com/cn/zh.html","a12":"-","a13":"1541525","a14":"4.2","a15":"100w+","a16":"1096182557@gmail.com","a17":"暂无"},
			],
		    
		  });
		  
			
		  
		  if(wxx.getParam()){
		  	localStorage.setItem("jingjiang_controller_index", wxx.getParam().id);
		  	localStorage.setItem("jingjiang_controller_pid", wxx.getParam().pid);
		  	localStorage.setItem("jingjiang_controller_max", wxx.getParam().maxid);
		  }
		  this_pid = wxx.getParam() ? wxx.getParam().pid   : localStorage.getItem("jingjiang_controller_pid"); 
		  this_max = wxx.getParam() ? wxx.getParam().maxid : localStorage.getItem("jingjiang_controller_max"); 
		  this_id  = wxx.getParam() ? wxx.getParam().id    : localStorage.getItem("jingjiang_controller_index");
		  this_id && PAGES.get_brand_category(this_max)
		  
		  
		  
		});
	},
	
	
	//  获取分类数据
	get_brand_category:function(id){
		var datas = {
		 	url  :'/api/brand_category/getData', 
		 	http_type:'POST',
			datas:{
				parent_id:id
			}
		}
		wxx.HttpReqeust(datas,function(ret){
		 	if(ret.code == 1){
				
				for (var i = 0; i < ret.data.length; i++) {
					ret.data[i].max_id = this_max*1
					if(ret.data[i].id == this_pid){
						ret.data[i].thisActive = true;
						if(ret.data[i].children && ret.data[i].children.length){
							for (var k = 0; k < ret.data[i].children.length; k++) {
								if(ret.data[i].children[k].id == this_id){
									ret.data[i].children[k].thisActive = true;
								}
							}
						}
					} 
				}
				console.log(ret)
				
				var html = template('SHOW_TYPE_SCRIPT', ret);
				$("#SHOW_TYPE").empty().append(html); 
				
				if(ret.data && ret.data.length){
					//  调用一下公共分类展开收起等方法
					wxx.init_types();
					$('.m_alls').show();
					
					//  查询一下是否每个分类都是有子级  全部没有的话  隐藏【全部展开】
					var is = false;
					for (var i = 0; i < ret.data.length; i++) {
						if( ret.data[i].children && ret.data[i].children.length){
							is = true;
						}
					}
					if(is==false){$('.m_alls').hide();}
					
				}else{
					$('.m_alls').hide();
				}
		 	}
		});
	},
	
	
	
	
	// 分页功能
	wxx_pages:function(){
		layui.use(function(){
		  var laypage = layui.laypage;
		  // 完整显示
		  laypage.render({
		    elem: 'demo-laypage-all', // 元素 id
		    count: 100, // 数据总数
		    layout: [ 'prev', 'page', 'next','skip','count',  ], // 功能布局
			prev: '<em>←</em>',
			next: '<em>→</em>',
		    jump: function(obj){
		      
		    }
		  });
		});
		
	},

	
}

var t_w = $('.p_tables_view').innerWidth()
if(t_w){
	PAGES.init_table(t_w);
}






